:root {
    /* Dark theme colors (matching the dark.png) */
    --bg-primary: #000000;
    --bg-secondary: #0a0a0a;
    --bg-tertiary: #1a1a1a;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --text-muted: #666666;
    --border-color: #333333;
    --border-subtle: #1a1a1a;
    --accent-color: #ffffff;
    --accent-hover: #f0f0f0;
    --user-bg: #1a1a1a;
    --assistant-bg: #0a0a0a;
    --input-bg: #0a0a0a;
    --input-border: #333333;
    --button-bg: #ffffff;
    --button-text: #000000;
    --button-hover: #e0e0e0;
    --pill-bg: transparent;
    --pill-border: #333333;
    --pill-hover: #1a1a1a;
    --tool-bg: #0f0f0f;
    --code-bg: #0f0f0f;
}

/* Light theme */
@media (prefers-color-scheme: light) {
    :root {
        --bg-primary: #ffffff;
        --bg-secondary: #fafafa;
        --bg-tertiary: #f5f5f5;
        --text-primary: #000000;
        --text-secondary: #666666;
        --text-muted: #999999;
        --border-color: #e1e5e9;
        --border-subtle: #f0f0f0;
        --accent-color: #000000;
        --accent-hover: #333333;
        --user-bg: #f0f0f0;
        --assistant-bg: #fafafa;
        --input-bg: #ffffff;
        --input-border: #e1e5e9;
        --button-bg: #000000;
        --button-text: #ffffff;
        --button-hover: #333333;
        --pill-bg: #f5f5f5;
        --pill-border: #e1e5e9;
        --pill-hover: #e8eaed;
        --tool-bg: #f8f9fa;
        --code-bg: #f5f5f5;
    }

    header h1::before {
        background-image: url('/static/img/logo_light.png');
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    height: 100vh;
    overflow: hidden;
    font-size: 14px;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 100%;
    margin: 0 auto;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-subtle);
}

header h1 {
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

header h1::before {
    content: "";
    width: 32px;
    height: 32px;
    background-image: url('/static/img/logo_dark.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    display: inline-block;
}

.status {
    font-size: 0.75rem;
    color: var(--text-secondary);
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

.status.connected {
    color: #10b981;
    border-color: #10b981;
    background-color: rgba(16, 185, 129, 0.1);
}

.status.disconnected {
    color: #ef4444;
    border-color: #ef4444;
    background-color: rgba(239, 68, 68, 0.1);
}

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.welcome-message {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.welcome-message h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-weight: 600;
}

.welcome-message p {
    font-size: 1rem;
    margin-bottom: 2rem;
}

/* Suggestion pills like in the design */
.suggestion-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    margin-top: 2rem;
}

.suggestion-pill {
    padding: 0.75rem 1.25rem;
    background-color: var(--pill-bg);
    border: 1px solid var(--pill-border);
    border-radius: 2rem;
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
}

.suggestion-pill:hover {
    background-color: var(--pill-hover);
    border-color: var(--border-color);
}

.message {
    max-width: 80%;
    padding: 1rem 1.25rem;
    border-radius: 1rem;
    word-wrap: break-word;
    position: relative;
}

.message.user {
    align-self: flex-end;
    background-color: var(--user-bg);
    margin-left: auto;
    border: 1px solid var(--border-subtle);
}

.message.assistant {
    align-self: flex-start;
    background-color: var(--assistant-bg);
    border: 1px solid var(--border-subtle);
}

.message-content {
    flex: 1;
    margin-bottom: 0.5rem;
}

.message .timestamp {
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    opacity: 0.7;
}

.message pre {
    background-color: var(--code-bg);
    padding: 0.75rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    margin: 0.75rem 0;
    border: 1px solid var(--border-color);
    font-size: 0.8125rem;
}

.message code {
    background-color: var(--code-bg);
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 0.8125rem;
    border: 1px solid var(--border-color);
}

.input-container {
    display: flex;
    gap: 0.75rem;
    padding: 1.5rem;
    background-color: var(--bg-primary);
    border-top: 1px solid var(--border-subtle);
}

#message-input {
    flex: 1;
    padding: 0.875rem 1rem;
    border: 1px solid var(--input-border);
    border-radius: 0.75rem;
    background-color: var(--input-bg);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.875rem;
    resize: none;
    min-height: 2.75rem;
    max-height: 8rem;
    outline: none;
    transition: border-color 0.2s ease;
}

#message-input:focus {
    border-color: var(--accent-color);
}

#message-input::placeholder {
    color: var(--text-muted);
}

#send-button {
    padding: 0.875rem 1.5rem;
    background-color: var(--button-bg);
    color: var(--button-text);
    border: none;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 4rem;
}

#send-button:hover {
    background-color: var(--button-hover);
    transform: translateY(-1px);
}

#send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

#send-button.cancel-mode {
    background-color: #ef4444;
    color: #ffffff;
}

#send-button.cancel-mode:hover {
    background-color: #dc2626;
}

/* Scrollbar styling */
.messages::-webkit-scrollbar {
    width: 6px;
}

.messages::-webkit-scrollbar-track {
    background: transparent;
}

.messages::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.messages::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Tool call styling */
.tool-message, .tool-result, .tool-error, .tool-confirmation, .context-warning {
    background-color: var(--tool-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1rem;
    margin: 0.75rem 0;
    max-width: 90%;
}

.tool-header, .tool-confirm-header, .context-header {
    font-weight: 600;
    color: var(--accent-color);
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
}

.tool-content {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.tool-param {
    margin: 0.5rem 0;
}

.tool-param strong {
    color: var(--text-primary);
}

.tool-running {
    font-size: 0.8125rem;
    color: var(--accent-color);
    margin-top: 0.75rem;
    font-style: italic;
}

.tool-error {
    border-color: #ef4444;
    background-color: rgba(239, 68, 68, 0.05);
}

.tool-error strong {
    color: #ef4444;
}

.tool-result {
    background-color: var(--tool-bg);
    border-left: 3px solid var(--accent-color);
    margin-left: 1.5rem;
    border-radius: 0.5rem;
}

.tool-confirmation {
    border-color: #f59e0b;
    background-color: rgba(245, 158, 11, 0.05);
}

.tool-confirm-note, .context-note {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.75rem;
    font-style: italic;
}

.context-warning {
    border-color: #f59e0b;
    background-color: rgba(245, 158, 11, 0.05);
}

.context-header {
    color: #f59e0b;
}

.system-message {
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
    margin: 1rem 0;
    font-size: 0.875rem;
}

.cancelled {
    color: #ef4444;
}

/* Thinking indicator */
.thinking-message {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-secondary);
    font-style: italic;
    padding: 1rem 1.25rem;
    background-color: var(--bg-secondary);
    border-radius: 1rem;
    border: 1px solid var(--border-subtle);
    max-width: 80%;
    font-size: 0.875rem;
}

.thinking-dots {
    display: flex;
    gap: 0.25rem;
}

.thinking-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--text-secondary);
    animation: thinking-bounce 1.4s infinite ease-in-out both;
}

.thinking-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.thinking-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes thinking-bounce {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Keep the old loading indicator for backwards compatibility */
.loading-message {
    display: none;
}

/* Responsive design */
@media (max-width: 768px) {
    .messages {
        padding: 1rem;
        gap: 1rem;
    }

    .message {
        max-width: 90%;
        padding: 0.875rem 1rem;
    }

    .input-container {
        padding: 1rem;
    }

    header {
        padding: 0.75rem 1rem;
    }

    .welcome-message {
        padding: 2rem 1rem;
    }
}